#!/bin/env python3
# -*- coding:utf-8 -*-
"""
    Add By :e4ting chendejun@antiy.cn 2022-09-09 10:57:41
    docker run --rm -ti --net airflow_default -u root --env-file .env --name threat.data -v /home/aliyun/:/code -w /code e4ting/airflow:2.2.2 bash -c "celery -A apps.app worker -P gevent -Q data.threat"
"""
import sys,os
from pdb import set_trace as strace
from traceback  import format_exc as dumpstack

import os
import sys

from celery import Celery,platforms
from celery_once import QueueOnce
import functools

from config.celery import celeryconfig

# from kombu import Exchange, Queue

platforms.C_FORCE_ROOT = True

# include:导入指定的任务模块
# 创建 app，并没有直接指定 broker(消息中间件来接收和发送任务消息) 和 backend(存储结果)。而是在配置文件中。
app = Celery(
    'celery',
    # include=[
    #     "celerys.tasks.task",
    # ],
)

# 通过Celery 实例加载配置模块，在celeryconfig中声明各种配置
app.config_from_object(celeryconfig)
